Skip to content

Use fallback oracles in Rust client#838

Merged
Lou-Kamades merged 25 commits intodevfrom
lou/fallback-oracles-client
Jan 23, 2024
Merged

Use fallback oracles in Rust client#838
Lou-Kamades merged 25 commits intodevfrom
lou/fallback-oracles-client

Conversation

@Lou-Kamades
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions bot added the program On-chain program changes label Jan 4, 2024
Comment thread lib/client/src/context.rs Outdated
@Lou-Kamades Lou-Kamades changed the title WIP: Use fallback oracles in Rust client Use fallback oracles in Rust client Jan 10, 2024
Comment thread lib/client/src/context.rs Outdated
Comment thread lib/client/src/client.rs Outdated
Comment thread bin/keeper/src/main.rs Outdated
Comment thread bin/liquidator/src/liquidate.rs Outdated
Comment thread lib/client/src/account_fetcher.rs Outdated
let oracle_acc = &KeyedAccountSharedData::new(bank.oracle, oracle.into());
let price = bank.oracle_price(&OracleAccountInfos::from_reader(oracle_acc), None)?;
let oracle_data = self.fetch_raw(&bank.oracle)?;
let oracle = &KeyedAccountSharedData::new(bank.oracle, oracle_data.into());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like oracle could also be fetched with the new helper?

Comment thread lib/client/src/client.rs Outdated
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracles-client branch 2 times, most recently from e73d551 to fbb0c84 Compare January 11, 2024 21:14
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracles-client branch from fbb0c84 to b70d3cb Compare January 11, 2024 21:16
Comment thread lib/client/src/account_fetcher.rs Outdated
Comment thread lib/client/src/chain_data_fetcher.rs Outdated
Comment thread lib/client/src/client.rs Outdated
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracles-client branch from 2b0e9f1 to 7417ae2 Compare January 20, 2024 17:26
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracles-client branch from 7417ae2 to 46be2eb Compare January 20, 2024 17:31
Comment thread lib/client/src/account_fetcher.rs Outdated
@Lou-Kamades Lou-Kamades merged commit db98ba5 into dev Jan 23, 2024
@Lou-Kamades Lou-Kamades deleted the lou/fallback-oracles-client branch January 23, 2024 16:26
Lou-Kamades added a commit that referenced this pull request Jan 24, 2024
* rename usd_opt to usdc_opt in OracleAccountInfos

* use fallbacks when fetching bank+ price in AccountFetcher struct

* feat: add derive_fallback_oracle_keys to MangoGroupContext

* test: properly assert failure CU in test_health_compute_tokens_fallback_oracles

* provide fallback oracle accounts in the rust client

* liquidator: update for fallback oracles

* set fallback config in mango services

* support fallback oracles in rust settler + keeper

* fix send error related to fetching fallbacks dynamically in tcs_start

* drop derive_fallback_oracle_keys_sync

* add fetch_multiple_accounts to AccountFetcher trait

* revert client::new() api

* deriving oracle keys uses account_fetcher

* use client helpers for deriving health_check account_metas

* add health_cache helper to mango client

* add get_slot to account_fetcher

* lint

* cached account fetcher only fetches uncached accounts

* ensure keeper client does not use cached oracles for staleness checks

* address minor review comments

* create unique job keys for CachedAccountFetcher.fetch_multiple_accounts

* fmt

* improve hashing in CachedAccountFetcher.fetch_multiple_accounts

---------

Co-authored-by: Christian Kamm <mail@ckamm.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

program On-chain program changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants